import React, { Component } from 'react';
import styles from './index.less';
import { saveAs } from 'file-saver';

export default class extends Component {
  componentDidMount = () => {
    console.log(this.options);
  };

  func = () => {
    var blob = new Blob(['Hello, World!'], {
      type: 'text/plain;charset=utf-8',
    });
    saveAs(blob, 'example.txt');
  };
  render() {
    return (
      <div
        onClick={() => {
          this.func();
        }}
      >
        下载文件
      </div>
    );
  }
}
